﻿using System.ComponentModel;
using Styx;
using Styx.Common;
using Styx.Helpers;
using Styx.WoWInternals.WoWObjects;

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Styx.WoWInternals;

namespace CombatPuller.Settings
{
    internal class CPSettings : Styx.Helpers.Settings
    {
        private static CPSettings _instance;
        private static LocalPlayer Me { get { return StyxWoW.Me; } }

        private CPSettings()
            : base(SettingsPath + ".config")
        {
        }

        public static CPSettings Instance
        {
            get { return _instance ?? (_instance = new CPSettings()); }
        }

        private static string SettingsPath
        {
            get
            {
                return string.Format("{0}\\Settings\\{1}\\{2}\\CombatPuller", Utilities.AssemblyDirectory, Realm, Me.Name);
            }
        }

		private static string Realm
        {
            get
            {
                string realm;
                try
                {
                    realm = Lua.GetReturnVal<string>("return GetRealmName()", 0);
                }
                catch (Exception)
                {
                    realm = "NOrealm";
                }
                return realm;
            }
        }

        [Setting]
        [Styx.Helpers.DefaultValue(3)]
        [Category("- Controls")]
        [DisplayName("MAX Mobs")]
        [Description("Max Number of Mobs to fight at the same Time")]
        public int MobMax { get; set; }
		
		[Setting]
        [Styx.Helpers.DefaultValue(50)]
        [Category("- Controls")]
        [DisplayName("Range")]
        [Description("Range for Pull")]
        public int PullRange { get; set; }
		
		[Setting]
        [Styx.Helpers.DefaultValue(50)]
        [Category("- Controls")]
        [DisplayName("MAX Health")]
        [Description("Stop Pulling if Max Health Below %")]
        public int MaxHealth { get; set; }
		
		[Setting]
        [Styx.Helpers.DefaultValue(10)]
        [Category("- Controls")]
        [DisplayName("MAX Corpses")]
        [Description("Force Loot if Lootable Corpses are More than the value")]
        public int MaxCorpse { get; set; }
		
		[Setting]
        [Styx.Helpers.DefaultValue(0)]
        [Category("- Controls")]
        [DisplayName("Timer in Min.")]
        [Description("Activate addon for a specific amount of time (in Min.)")]
        public int RunTime { get; set; }
		
		[Setting]
        [Styx.Helpers.DefaultValue("0")]
        [Category("- Targets")]
        [DisplayName("Faction List")]
        [Description("Faction IDs to Pull. Example: 1 23 43 12 32 33")]
        public string FList { get; set; }
		
		[Setting]
        [Styx.Helpers.DefaultValue(false)]
        [Category("- Targets")]
        [DisplayName("All Factions")]
        [Description("Kill every Faction regardless the Settings")]
        public bool AllFactions { get; set; }

		[Setting]
        [Styx.Helpers.DefaultValue("0")]
        [Category("- Targets")]
        [DisplayName("Blacklist")]
        [Description("ENTRY ID Target to Blacklist. Example: 1 23 43 12 32 33")]
        public string BList { get; set; }
		
		[Setting]
        [Styx.Helpers.DefaultValue(false)]
        [Category("- non-Stop")]
        [DisplayName("Pull in fight")]
        [Description("Pull in fight if [pulled mobs] < [MAX Mobs]")]
        public bool PullInFight { get; set; }
		
		[Setting]
        [Styx.Helpers.DefaultValue(false)]
        [Category("- non-Stop")]
        [DisplayName("Loot in fight")]
        [Description("Loot in fight MAX Coprses not used here")]
        public bool LootInCombat { get; set; }
		
    }
}
